package com.rabbitmq.receivers;

import com.rabbitmq.config.WorkConfig;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 工作模式：一个生产者，多个消费者，一个队列，采用默认交换机
 *
 * @author 王霄
 * @date 2022/1/8 16:46
 */
@Component
public class WorkReceiver {

    @RabbitListener(queues = WorkConfig.QUEUE_NAME)
    public void consume1(String message) {
        System.out.println("消费者1接收到Work模式的消息 : " + message);
    }

    @RabbitListener(queues = WorkConfig.QUEUE_NAME)
    public void consume2(String message) {
        System.out.println("消费者2接收到Work模式的消息 : " + message);
    }

    @RabbitListener(queues = WorkConfig.QUEUE_NAME)
    public void consume3(String message) {
        System.out.println("消费者3接收到Work模式的消息 : " + message);
    }


}
